<template>
	<view class="content">
		<view class="lottery">
			<dengbo-lotteryScratch backgroundCard="/static/ggl.png" backgroundImage="/static/gglbj.png"
				ref="card" @complete="seatShow" :disabled="disabled" :lightImgs="lightImages">
				<!-- 刮刮卡内容保持不变 -->
				<template v-slot:scratch-value>
					<view style="width: 462rpx; height: 228rpx; text-align: center">恭喜你获得IPhone手机一部</view>
				</template>
			</dengbo-lotteryScratch>
			<view v-if="disabled"
				style="width: 100%; height: 100%; position: absolute; left: 0; top: 0;display: flex;align-items: center;justify-content: center;">
				<image src="/static/gan.png" style="width: 274rpx; height: 82rpx" @click.stop="openCard" />
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				lightImages: ['/static/gpoint1.png', '/static/gpoint2.png'],
				disabled: true,
			}
		},
		onLoad() {

		},
		methods: {
			openCard() {
				console.log('刮刮卡开始');
				this.$refs.card.init(); // 重置刮刮卡
				this.disabled = false;
			},

			seatShow() {
				console.log('刮刮卡完成');
				this.disabled = true;
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.lottery {
		margin-top: 100rpx;
		position: relative;
		display: inline-block;
		width: 690rpx;
		height: 460rpx;
	}
</style>